// 服务器状态API
export const getServerStatus = async () => {
  try {
    const response = await fetch('https://list.mczfw.cn/api/mc.kbblet.cn')
    const data = await response.json()
    
    return {
      online: data.p !== undefined && data.status !== 'offline',
      playerCount: data.p || 0,
      maxPlayers: data.mp || 50,
      ping: data.ping || 0,
      version: data.version || '1.21.4'
    }
  } catch (error) {
    console.error('获取服务器状态失败:', error)
    return {
      online: false,
      playerCount: 0,
      maxPlayers: 50,
      ping: 0,
      version: '1.21.4'
    }
  }
}

// 模拟数据API
export const getNewsData = () => {
  return [
    {
      id: 1,
      title: '服务器正式开放！',
      date: '2024-01-15',
      content: '欢迎来到KBB服务器！我们是一个充满活力的Minecraft社区...',
      imageUrl: '/images/news1.jpg'
    },
    {
      id: 2,
      title: '新功能上线公告',
      date: '2024-01-10',
      content: '我们新增了多个实用功能，包括皮肤系统、传送系统等...',
      imageUrl: '/images/news2.jpg'
    }
  ]
}

export const getStaffData = () => {
  return [
    {
      id: 1,
      name: 'Admin',
      role: '服务器管理员',
      avatarUrl: '/images/avatar1.jpg',
      bio: '负责服务器的日常维护和管理工作'
    },
    {
      id: 2,
      name: 'Moderator',
      role: '游戏管理员',
      avatarUrl: '/images/avatar2.jpg',
      bio: '负责游戏内的秩序维护和玩家支持'
    }
  ]
}

export const getGalleryData = () => {
  return [
    {
      id: 1,
      title: '主城风光',
      url: '/images/gallery1.jpg'
    },
    {
      id: 2,
      title: '玩家建筑',
      url: '/images/gallery2.jpg'
    }
  ]
}

export const getDonorData = () => {
  return [
    {
      id: 1,
      name: '热心玩家A',
      amount: 100,
      date: '2024-01-15',
      message: '支持服务器发展！'
    },
    {
      id: 2,
      name: '热心玩家B',
      amount: 50,
      date: '2024-01-10',
      message: '希望服务器越来越好'
    }
  ]
}

export const getBanListData = () => {
  return [
    {
      playerName: '违规玩家1',
      uuid: 'uuid1',
      reason: '恶意破坏',
      banDate: '2024-01-15',
      unbanDate: '2024-02-15'
    },
    {
      playerName: '违规玩家2',
      uuid: 'uuid2',
      reason: '使用外挂',
      banDate: '2024-01-10',
      unbanDate: '永久封禁'
    }
  ]
} 